package cn.iocoder.yudao.module.oauth2.api.oauth2;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.oauth2.service.oauth2.OAuth2ClientService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;

import static cn.iocoder.yudao.module.system.enums.ApiConstants.VERSION;

/**
 * @author Administrator
 * @RestController // 提供 RESTful API 接口，给 Feign 调用
 * @DubboService(version = VERSION) // 提供 Dubbo RPC 接口，给 Dubbo Consumer 调用
 */
@RestController
@DubboService(version = VERSION)
@Validated
public class OAuth2ClientApiImpl implements OAuth2ClientApi {

    private final OAuth2ClientService oAuth2ClientService;

    public OAuth2ClientApiImpl(OAuth2ClientService oAuth2ClientService) {
        this.oAuth2ClientService = oAuth2ClientService;
    }

    @Override
    public CommonResult<Boolean> initLocalCache() {
        oAuth2ClientService.initLocalCache();
        return CommonResult.success(true);
    }
}
